package com.greyshark.lib.bluetooth.scan;

public abstract class BaseBleScanner {
    public final static long defaultTimeout = 10 * 1000;
    /**
     * android 7.0 后不能在30秒内扫描停止的次数超过5次。（官网没特意说明，可自行测试，设置扫描时长为3秒，连续扫描10次，
     * 稳定复现5次后不能扫描到任何设备。故：5 * STOP_SCAN_TIME_DELAY 时间须小于 30s
     */
    public final static long STOP_SCAN_TIME_DELAY = 8 * 1000;
    protected boolean isScanning;

    protected boolean isStop;

    public abstract void onStartBleScan();
//    public abstract void onStartBleScan(long timeoutMillis);

    public abstract void onStopBleScan();

    public abstract void onBleScanFailed(MyBleScanState scanState);

    public boolean isScanning() {
        return isScanning;
    }

//    protected Handler timeoutHandler  = new Handler();
//    protected Runnable timeoutRunnable = new Runnable() {
//        @Override
//        public void run() {
//            onStopBleScan();
//            onBleScanFailed(MyBleScanState.SCAN_TIMEOUT);
//        }
//    };
}
